<template>
    <div id="system" class="warp system">
        <postHead active="date" :showAction="true"></postHead>
        <div class="container">
			<div class="calendarwrap">
				<div class="calendar-lt">
					<div class="calendar-box">
						<div class="calendar-content">
							<div class="calendar-content-select">
								<select class="calendar-form-control jaycurrentyear">

								<option value="2016">2016</option><option value="2017">2017</option><option value="2018">2018</option><option value="2019">2019</option><option value="2020">2020</option><option value="2021">2021</option><option value="2022">2022</option><option value="2023">2023</option><option value="2024">2024</option><option value="2025" selected="selected">2025</option><option value="2026">2026</option></select> <select class="calendar-form-control jaycurrentmonth">

								<option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5" selected="">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option><option value="11">11</option><option value="12">12</option></select>
							</div>
							<div class="calendar-content-new">
								<table class="table-calendar">
									<tbody><tr>
										<th>一</th>
										<th>二</th>
										<th>三</th>
										<th>四</th>
										<th>五</th>
										<th>六</th>
										<th>日</th>
									</tr>

								<tr><td data-dt="2025-4-28"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">28</span> <span class="calendar-date-lunar">初一</span></a></div></td><td data-dt="2025-4-29"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">29</span> <span class="calendar-date-lunar">初二</span></a></div></td><td data-dt="2025-4-30"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">30</span> <span class="calendar-date-lunar">初三</span></a></div></td><td data-dt="2025-5-1"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">1</span> <span class="calendar-date-lunar">劳动节</span></a></div></td><td data-dt="2025-5-2"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">2</span> <span class="calendar-date-lunar">初五</span></a></div></td><td data-dt="2025-5-3"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">3</span> <span class="calendar-date-lunar">初六</span></a></div></td><td data-dt="2025-5-4"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">4</span> <span class="calendar-date-lunar">初七</span></a></div></td></tr><tr><td data-dt="2025-5-5"><div class="calendar-table-relative"><a class="calendar-date on"><span class=""></span> <span class="calendar-date-grego">5</span> <span class="calendar-date-lunar">立夏</span></a></div></td><td data-dt="2025-5-6"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">6</span> <span class="calendar-date-lunar">初九</span></a></div></td><td data-dt="2025-5-7"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">7</span> <span class="calendar-date-lunar">初十</span></a></div></td><td data-dt="2025-5-8"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">8</span> <span class="calendar-date-lunar">十一</span></a></div></td><td data-dt="2025-5-9"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">9</span> <span class="calendar-date-lunar">十二</span></a></div></td><td data-dt="2025-5-10"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">10</span> <span class="calendar-date-lunar">十三</span></a></div></td><td data-dt="2025-5-11"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">11</span> <span class="calendar-date-lunar">十四</span></a></div></td></tr><tr><td data-dt="2025-5-12"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">12</span> <span class="calendar-date-lunar">十五</span></a></div></td><td data-dt="2025-5-13"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">13</span> <span class="calendar-date-lunar">十六</span></a></div></td><td data-dt="2025-5-14"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">14</span> <span class="calendar-date-lunar">十七</span></a></div></td><td data-dt="2025-5-15"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">15</span> <span class="calendar-date-lunar">十八</span></a></div></td><td data-dt="2025-5-16"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">16</span> <span class="calendar-date-lunar">十九</span></a></div></td><td data-dt="2025-5-17"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">17</span> <span class="calendar-date-lunar">二十</span></a></div></td><td data-dt="2025-5-18"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">18</span> <span class="calendar-date-lunar">廿一</span></a></div></td></tr><tr><td data-dt="2025-5-19"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">19</span> <span class="calendar-date-lunar">廿二</span></a></div></td><td data-dt="2025-5-20"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">20</span> <span class="calendar-date-lunar">廿三</span></a></div></td><td data-dt="2025-5-21"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">21</span> <span class="calendar-date-lunar">小满</span></a></div></td><td data-dt="2025-5-22"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">22</span> <span class="calendar-date-lunar">廿五</span></a></div></td><td data-dt="2025-5-23"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">23</span> <span class="calendar-date-lunar">廿六</span></a></div></td><td data-dt="2025-5-24"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">24</span> <span class="calendar-date-lunar">廿七</span></a></div></td><td data-dt="2025-5-25"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">25</span> <span class="calendar-date-lunar">廿八</span></a></div></td></tr><tr><td data-dt="2025-5-26"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">26</span> <span class="calendar-date-lunar">廿九</span></a></div></td><td data-dt="2025-5-27"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">27</span> <span class="calendar-date-lunar">初一</span></a></div></td><td data-dt="2025-5-28"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">28</span> <span class="calendar-date-lunar">初二</span></a></div></td><td data-dt="2025-5-29"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">29</span> <span class="calendar-date-lunar">初三</span></a></div></td><td data-dt="2025-5-30"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">30</span> <span class="calendar-date-lunar">初四</span></a></div></td><td data-dt="2025-5-31"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">31</span> <span class="calendar-date-lunar">端午节</span></a></div></td><td data-dt="2025-6-1"><div class="calendar-table-relative"><a class="calendar-date"><span class=""></span> <span class="calendar-date-grego">1</span> <span class="calendar-date-lunar">儿童节</span></a></div></td></tr></tbody></table>
							</div>
						</div>
						<!-- /.calendar-content -->

						<div class="calendar-matter">
							<div class="calendar-matter-date">5月5&nbsp;&nbsp;周一</div>
							<div class="calendar-matter-info">
								<ul class="calendar-matter-info-list">

								</ul>
							</div>
							<div class="calendar-matter-stat">
								<a class="statbtn lt">年度安排面试共0次</a> <a class="statbtn rt">年度安排面试共0天</a>
							</div>
						</div>
						<!-- /.calendar-matter -->
					</div>
					<!-- /.calendar-box -->
				</div>
				<!-- /.calendar-lt -->

				<div class="calendar-rt">

					<!-- 按周显示 -->
					<div class="backlog">
						<table class="table table-backlog jayweek">
							<thead>
								<tr>
									<th class="backlog-th1">5月</th>
									<th>一</th>
									<th>二</th>
									<th>三</th>
									<th>四</th>
									<th>五</th>
									<th>六</th>
									<th>日</th>
								</tr>
								<tr>
									<th></th>
									<th style="border-bottom: 2px solid rgb(252, 123, 36);"><span class="calendar-date-grego">5</span> <span class="calendar-date-lunar">立夏</span></th>
									<th style="border-bottom: 2px solid rgb(221, 221, 221);"><span class="calendar-date-grego">6</span> <span class="calendar-date-lunar">初九</span></th>
									<th style="border-bottom: 2px solid rgb(221, 221, 221);"><span class="calendar-date-grego">7</span> <span class="calendar-date-lunar">初十</span></th>
									<th style="border-bottom: 2px solid rgb(221, 221, 221);"><span class="calendar-date-grego">8</span> <span class="calendar-date-lunar">十一</span></th>
									<th style="border-bottom: 2px solid rgb(221, 221, 221);"><span class="calendar-date-grego">9</span> <span class="calendar-date-lunar">十二</span></th>
									<th style="border-bottom: 2px solid rgb(221, 221, 221);"><span class="calendar-date-grego">10</span> <span class="calendar-date-lunar">十三</span></th>
									<th style="border-bottom: 2px solid rgb(221, 221, 221);"><span class="calendar-date-grego">11</span> <span class="calendar-date-lunar">十四</span></th>
								</tr>
							</thead>
							<tbody>
								<tr>
									<th>08:00</th>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
								</tr>
								<tr>
									<th>09:00</th>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
								</tr>
								<tr>
									<th>10:00</th>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
								</tr>
								<tr>
									<th>11:00</th>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
								</tr>
								<tr>
									<th>12:00</th>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
								</tr>
								<tr>
									<th>13:00</th>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
								</tr>
								<tr>
									<th>14:00</th>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
								</tr>
								<tr>
									<th>15:00</th>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
								</tr>
								<tr>
									<th>16:00</th>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
								</tr>
								<tr>
									<th>17:00</th>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
								</tr>
								<tr>
									<th>18:00</th>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
								</tr>
								<tr>
									<th>19:00</th>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
								</tr>
								<tr>
									<th>20:00</th>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
								</tr>
								<tr>
									<th>21:00</th>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
									<td></td>
								</tr>
							</tbody>
						</table>
					</div>
					<!-- 按周显示 end -->


				</div>
				<!-- /.calendar-rt -->
			</div>
			<!-- /.calendarwrap -->
		</div>
       
    </div>
</template>
<script>
import {
    regionData,
    codeToText
} from "element-china-area-data";
import postHead from '@/components/postHead.vue';
import homeapi from '@/api/api.js'
import until from '@/api/until'
export default {
    name: 'login',
    data() {
        return {
            phone: "",
            haveCheck: false,
            code: "",
            title: "",
            loginType: 1,
            loginCode: 1,
            active: 2,
            form: {
                annualRevenue: "",
                annualRevenueName: '',
                contactName: "",
                creditCode: "",
                email: "",
                enterpriseIndustry: "",

                enterpriseNature: "",

                enterpriseScale: "",

                landlineNumber: "",
                licenceImg: "",
                licenceImgUrl: "",
                listingType: "",
                listingTypeName: "",
                name: "",
                officialWebsite: "",
                phone: "",
                staffsNum: "",
                staffsNumName: '',
                wechatOfficialAccount: "",
                inviteCode: "",
                inviter: "",

                inviterPhone: "",

            },

            userForm: {
                inviteCode: "",
                inviter: "",
                inviterPhone: "",
                name: "",
                nickName: "",
                workplace: "",
                idCard: "",
                personHighestDegree: {

                },
                personImportantUnits: {

                }
            },
            enterpriseScaleList: [],
            enterpriseIndustry: [],
            enterpriseNatureList: [],
            staffsNumList: [],

            regionDatas: regionData,
            cateProps: {
                value: "value",
                label: "label",
                children: "children",
            },
            props: {
                value: "id",
                label: "text",
                children: "children",

            },
            showCode: true,
            time: 60,
        }
    },
    components: {
        postHead
    },
    mounted() {
        let title = this.$route.query.title
        if (title) {
            this.title = title
        }
        else {
            this.title = "AI爱招聘-注册"
        }
        this.getDictList();
        this.getIndustryList();
    },
    methods: {
        toLogin() {
            this.$router.push("/login/loginnew")
        },
        setActive(type) {
            this.active = type;
        },
        //获取数据字典
        async getDictList() {
            let data = await homeapi.getDictList();
            if (data.code == 200) {
                this.enterpriseScaleList = data.result.enterpriseScale
                this.enterpriseNatureList = data.result.enterpriseNature
                this.staffsNumList = data.result.staffsNum
            }
        },
        deleteImg() {
            this.form.licenceImg = ""
            this.form.licenceImgUrl = ""
        },

        //获取行业列表
        async getIndustryList() {
            let data = await homeapi.getIndustryList();
            if (data.code == 200) {
                data.result.map(res => {
                    res.text = res.name;
                    if (res.child.length > 0) {
                        res.child.map(json => {
                            json.text = json.name
                        })
                        res.children = res.child;
                        res.children.map(json => {
                            if (json.child.length > 0) {
                                json.child.map(item => {
                                    item.text = item.name
                                })
                                json.children = json.child

                            }
                            else {
                                json.children = [
                                    {
                                        text: json.text,
                                        id: json.id
                                    }
                                ]
                            }
                        })
                    }
                    else {
                        res.children = [
                            {
                                text: res.text,
                                children: [{
                                    text: res.text,
                                    id: res.id
                                }]
                            }
                        ]
                    }
                })

                this.enterpriseIndustry = data.result

            }
        },




        async sendCode() {
            let phone = this.phone
            if (phone.length != 11) {
                this.$message.error("请传入正确的手机号")
                return false;
            }

            let data = await homeapi.sendCode({ phone });

            if (data.code == 200) {
                this.showCode = false
                this.getTimeNext();
            }
            else {
                this.$message.error(data.message)

            }
        },

        getTimeNext() {
            if (this.time > 0) {
                this.time = this.time - 1;
                setTimeout(() => {
                    this.getTimeNext();
                }, 1000)
            }
            else {
                this.showCode = true;
                this.time = 60
            }
        },
        setCheck() {
            this.haveCheck = true;
        },
        async toRegister() {
            if (this.active == 2) {
                let code = this.code
                let phone = this.phone

                let type = this.active
                let form = this.userForm;
                form.code = code;
                form.phone = phone
                this.loading = true;
                let data = await homeapi.registerUser(form);
                if (data.code == 200) {
                    this.$message.success("注册成功")
                    until.setCookie("token", data.result);
                    this.$router.push("/user")


                }
                else {
                    this.loading = false
                    this.$message.error(data.message)
                }
            }
            else {
                let code = this.code
                let phone = this.phone
                let type = this.active
                let form = this.form;
                form.code = code;
                form.phone = phone
                this.loading = true;
                let data = await homeapi.registerCompany(form);
                if (data.code == 200) {
                    this.$message.success("注册成功")
                    until.setCookie("token", data.result);
                    this.$router.push("/")



                }
                else {
                    this.loading = false
                    this.$message.error(data.message)
                }
            }

        },
        async getUserInfo() {
            let data = await homeapi.getUserinfo();
            if (data.code == 402) {

            }
            if (data.code == 403) {
                this.$router.push("/company")

            }
            if (data.code == 200) {

            }

        },

        async sureEdit() {
            if (this.active == 1) {
                let form = this.form;

                let data = await homeapi.editCompany(form);
                if (data.code == 200) {
                    this.loading = false
                    this.$message.success("注册成功")
                    this.$router.push("/")
                }
            }
            else {
                let form = this.form;

                let data = await homeapi.editUser(form);
                if (data.code == 200) {
                    this.loading = false
                    this.$message.success("注册成功")
                    this.$router.push("/")
                }
            }

        },
        async changeFile(e) {
            if (e.target.files.length > 0) {
                let file = e.target.files[0]
                var formData = new FormData();
                // 服务端要求参数是 pic1 
                formData.append('file', file);
                let data = await homeapi.uploadFile(formData);
                if (data.code == 200) {

                    this.form.licenceImgUrl = data.result.url
                    this.form.licenceImg = data.result.path
                }
            }

        }


    }
}

</script>

<style scoped lang="less">
.footer {
    position: fixed;
}

.container {
    width: 100%;
    height: calc(100vh - 125px);
    overflow: auto;
    margin-top: 15px;
}

.main-left {
    position: fixed;
    top: 95px;
    bottom: 30px;
    background: #fff;
}

.system-lt {
    border: 0px;
}

.system-rt {
    border: 0px;
}

.main-right {
    margin-left: 0px;
}

.navbar-header {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.navbar-header span {
    font-size: 24px;
    color: #FC7B24;
    font-weight: bold;
}

.upload_div {
    width: 80px;
    height: 80px;
    border: 1px solid #e6e6e6;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}

.upload_div input {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.upload_div i {
    font-size: 18px;
}

.register-form-control {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}
</style>
